/**
 * 
 */
package ar.com.num.resources;

import java.io.InputStream;
import java.util.Properties;

import org.junit.Test;

import ar.com.mun.configuration.SEMCConfiguration;

import com.meterware.httpunit.GetMethodWebRequest;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebImage;
import com.meterware.httpunit.WebRequest;
import com.meterware.httpunit.WebResponse;

/**
 * @author William
 * 
 */
public class HttpUnitTestCase {

	@Test
	public void testIOsConfiguration(){
		Properties properties = SEMCConfiguration.getSearchStrategies();
	}
	
	@Test
	public void aHttpUnit(){
		try {
			// Create a conversation for maintaining state
			WebConversation wc = new WebConversation();

			// Obtain the home page on Google
			String url ="http://localhost:8080/municipalidadChivilcoy/downloadExportFile?";
			String params ="searchStrategyName=ExpedienteSearch&exportFileCommandName=ExcelFile&exportRowCommandName=ExpedienteRow&exportParameters=&separatorParameters=%2C";
			WebRequest request = new GetMethodWebRequest( url + params );
			WebResponse response = wc.getResponse( request );

			// Let's see how large Google's home page is
			int size = response.getContentLength();

			// Print out the page size
			System.out.println( "The Google home page is " + size + " Kb.");

			// Extract all the images
			InputStream a = response.getInputStream();
			int c;
			while( (c =a.read()) >0){
				System.out.print((char)c);
			}
		} catch (Exception e) {
			System.err.println( "Exception: " + e );
		}
	}
}
